package com.adl.telawa;

import org.amr.arabic.ArabicUtilities;

import android.content.Context;
import android.graphics.Typeface;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.ExpandableListView.OnGroupExpandListener;

/**
 * @author Adlane Achab.
 */
public class MyListAdapter extends BaseExpandableListAdapter implements OnChildClickListener, OnGroupExpandListener
{
	private static final int CHEIKH_MAHMOUD_EL_HOSSARI      = 0;
	private static final int CHEIKH_SAAD_EL_GHAMIDI         = 1;
	private static final int CHEIKH_ABD_EL_BASSAT           = 2;
	private static final int CHEIKH_EL_MINSHAWI             = 3;
	private static final int CHEIKH_EL_ADJAMI               = 4;
	private static final int CHEIKH_EL_CHREEM               = 5;
	private static final int CHEIKH_EL_SDISS                = 6;

	public static final int ARABIC  = 0;
	public static final int ENGLISH = 1;

	private static int _currentCheikh = CHEIKH_MAHMOUD_EL_HOSSARI;
	private static int _currentSurat = 0;

	private static final String suratLabelList[][] = new String [2][114];
	private static final String URLS_LIST [] []    = new String [7][114];
	private static final int    DEBITKB_LIST []    = new int    [7]     ;
	private static final String chikhList [][]     = new String [2][7]  ;
	private int language = ARABIC;

	static
	{
		chikhList[ARABIC][0] = ArabicUtilities.reshapeSentence("محمود خليل الحصري"); 
		chikhList[ENGLISH][0] = "El Hossari";
		chikhList[ARABIC][1] = ArabicUtilities.reshapeSentence("سعد الغامدي");
		chikhList[ENGLISH][1] = "Sa3d El Ghamidi";
		chikhList[ARABIC][2] = ArabicUtilities.reshapeSentence("عبد الباسط");
		chikhList[ENGLISH][2] = "Abd El Basset";
		chikhList[ARABIC][3] = ArabicUtilities.reshapeSentence("محمد صديق المنشاوي");
		chikhList[ENGLISH][3] = "El Minshawi";
		chikhList[ARABIC][4] = ArabicUtilities.reshapeSentence("أحمد العجمي");
		chikhList[ENGLISH][4] = "Ahmd El 3adjami";
		chikhList[ARABIC][5] = ArabicUtilities.reshapeSentence("سعود الشريم"); 
		chikhList[ENGLISH][5] = "El Chreem";
		chikhList[ARABIC][6] = ArabicUtilities.reshapeSentence("عبد الرحمن السديس");
		chikhList[ENGLISH][6] = "Al Sdeas";

		suratLabelList[ARABIC][0]   = ArabicUtilities.reshapeSentence("الفاتحة");
		suratLabelList[ENGLISH][0]   = "001 Al Fatiha"; 
		suratLabelList[ARABIC][1]   = ArabicUtilities.reshapeSentence("البقرة");
		suratLabelList[ENGLISH][1]   = "002 Al Bakara";
		suratLabelList[ARABIC][2]   = ArabicUtilities.reshapeSentence("آل عمران");
		suratLabelList[ENGLISH][2]   = "003 Al 3imran";
		suratLabelList[ARABIC][3]   = ArabicUtilities.reshapeSentence("النساء");
		suratLabelList[ENGLISH][3]   = "004 Al nissa";
		suratLabelList[ARABIC][4]   = ArabicUtilities.reshapeSentence("المائدة");
		suratLabelList[ENGLISH][4]   = "005 Al Maida";
		suratLabelList[ARABIC][5]   = ArabicUtilities.reshapeSentence("الأنعام");
		suratLabelList[ENGLISH][5]   = "006 Al An3am";
		suratLabelList[ARABIC][6]   = ArabicUtilities.reshapeSentence("الأعراف");
		suratLabelList[ENGLISH][6]   = "007 Al A3raf";
		suratLabelList[ARABIC][7]   = ArabicUtilities.reshapeSentence("الأنفال");
		suratLabelList[ENGLISH][7]   = "008 Al Anfal";
		suratLabelList[ARABIC][8]   = ArabicUtilities.reshapeSentence("التوبة");
		suratLabelList[ENGLISH][8]   = "009 Al Tawba";
		suratLabelList[ARABIC][9]   = ArabicUtilities.reshapeSentence("يونس");
		suratLabelList[ENGLISH][9]   = "010 Younoss";
		suratLabelList[ARABIC][10]  = ArabicUtilities.reshapeSentence("هود");
		suratLabelList[ENGLISH][10]  = "011 Hood";
		suratLabelList[ARABIC][11]  = ArabicUtilities.reshapeSentence("يوسف");
		suratLabelList[ENGLISH][11]  = "012 Youcef";
		suratLabelList[ARABIC][12]  = ArabicUtilities.reshapeSentence("الرعد");
		suratLabelList[ENGLISH][12]  = "013 Al Ra3d";
		suratLabelList[ARABIC][13]  = ArabicUtilities.reshapeSentence("إبراهيم");
		suratLabelList[ENGLISH][13]  = "014 Ibrahim";
		suratLabelList[ARABIC][14]  = ArabicUtilities.reshapeSentence("الحجر");
		suratLabelList[ENGLISH][14]  = "015 Al Hidjr";
		suratLabelList[ARABIC][15]  = ArabicUtilities.reshapeSentence("النحل");
		suratLabelList[ENGLISH][15]  = "016 Al Nahl";
		suratLabelList[ARABIC][16]  = ArabicUtilities.reshapeSentence("الإسراء");
		suratLabelList[ENGLISH][16]  = "017 Al Israa";
		suratLabelList[ARABIC][17]  = ArabicUtilities.reshapeSentence("الكهف");
		suratLabelList[ENGLISH][17]  = "018 Al Kahf";
		suratLabelList[ARABIC][18]  = ArabicUtilities.reshapeSentence("مريم");
		suratLabelList[ENGLISH][18]  = "019 Maryem";
		suratLabelList[ARABIC][19]  = ArabicUtilities.reshapeSentence("طه");
		suratLabelList[ENGLISH][19]  = "020 Taha";
		suratLabelList[ARABIC][20]  = ArabicUtilities.reshapeSentence("الأنبياء");
		suratLabelList[ENGLISH][20]  = "021 Al Anbiya";
		suratLabelList[ARABIC][21]  = ArabicUtilities.reshapeSentence("الحج");
		suratLabelList[ENGLISH][21]  = "022 Al Hadj";
		suratLabelList[ARABIC][22]  = ArabicUtilities.reshapeSentence("المؤمنون");
		suratLabelList[ENGLISH][22]  = "023 Al Mouminoun";
		suratLabelList[ARABIC][23]  = ArabicUtilities.reshapeSentence("النور");
		suratLabelList[ENGLISH][23]  = "024 Al Noor";
		suratLabelList[ARABIC][24]  = ArabicUtilities.reshapeSentence("الفرقان");
		suratLabelList[ENGLISH][24]  = "025 Al Forkan";
		suratLabelList[ARABIC][25]  = ArabicUtilities.reshapeSentence("الشعراء");
		suratLabelList[ENGLISH][25]  = "026 Al Sho3ara";
		suratLabelList[ARABIC][26]  = ArabicUtilities.reshapeSentence("النمل");
		suratLabelList[ENGLISH][26]  = "027 Al Naml";
		suratLabelList[ARABIC][27]  = ArabicUtilities.reshapeSentence("القصص");
		suratLabelList[ENGLISH][27]  = "028 Al Kassass";
		suratLabelList[ARABIC][28]  = ArabicUtilities.reshapeSentence("العنكبوت");
		suratLabelList[ENGLISH][28]  = "029 Al 3ankabout";
		suratLabelList[ARABIC][29]  = ArabicUtilities.reshapeSentence("الروم");
		suratLabelList[ENGLISH][29]  = "030 Al Roum";
		suratLabelList[ARABIC][30]  = ArabicUtilities.reshapeSentence("لقمان");
		suratLabelList[ENGLISH][30]  = "031 Lokman";
		suratLabelList[ARABIC][31]  = ArabicUtilities.reshapeSentence("السجدة");
		suratLabelList[ENGLISH][31]  = "032 Al Sadjda";
		suratLabelList[ARABIC][32]  = ArabicUtilities.reshapeSentence("الأحزاب");
		suratLabelList[ENGLISH][32]  = "033 Al Ahzab";
		suratLabelList[ARABIC][33]  = ArabicUtilities.reshapeSentence("سبأ");
		suratLabelList[ENGLISH][33]  = "034 Saba";
		suratLabelList[ARABIC][34]  = ArabicUtilities.reshapeSentence("فاطر");
		suratLabelList[ENGLISH][34]  = "035 Fatir";
		suratLabelList[ARABIC][35]  = ArabicUtilities.reshapeSentence("يس");
		suratLabelList[ENGLISH][35]  = "036 Yassin";
		suratLabelList[ARABIC][36]  = ArabicUtilities.reshapeSentence("الصافات");
		suratLabelList[ENGLISH][36]  = "037 Al Safat";
		suratLabelList[ARABIC][37]  = ArabicUtilities.reshapeSentence("ص");
		suratLabelList[ENGLISH][37]  = "038 Sad";
		suratLabelList[ARABIC][38]  = ArabicUtilities.reshapeSentence("الزمر");
		suratLabelList[ENGLISH][38]  = "039 Al Zomor";
		suratLabelList[ARABIC][39]  = ArabicUtilities.reshapeSentence("غافر");
		suratLabelList[ENGLISH][39]  = "040 Ghafir";
		suratLabelList[ARABIC][40]  = ArabicUtilities.reshapeSentence("فصلت");
		suratLabelList[ENGLISH][40]  = "041 Fossilat";
		suratLabelList[ARABIC][41]  = ArabicUtilities.reshapeSentence("الشورى");
		suratLabelList[ENGLISH][41]  = "042 Al Shoora";
		suratLabelList[ARABIC][42]  = ArabicUtilities.reshapeSentence("الزخرف");
		suratLabelList[ENGLISH][42]  = "043 Al Zokhrof";
		suratLabelList[ARABIC][43]  = ArabicUtilities.reshapeSentence("الدخان");
		suratLabelList[ENGLISH][43]  = "044 Al Dokhan";
		suratLabelList[ARABIC][44]  = ArabicUtilities.reshapeSentence("الجاثية");
		suratLabelList[ENGLISH][44]  = "045 Al Djathiya";
		suratLabelList[ARABIC][45]  = ArabicUtilities.reshapeSentence("الأحقاف");
		suratLabelList[ENGLISH][45]  = "046 Al Ahkaff";
		suratLabelList[ARABIC][46]  = ArabicUtilities.reshapeSentence("محمد");
		suratLabelList[ENGLISH][46]  = "047 Mohamed";
		suratLabelList[ARABIC][47]  = ArabicUtilities.reshapeSentence("الفتح");
		suratLabelList[ENGLISH][47]  = "048 Al Fath";
		suratLabelList[ARABIC][48]  = ArabicUtilities.reshapeSentence("الحجرات");
		suratLabelList[ENGLISH][48]  = "049 Al Hodjorat";
		suratLabelList[ARABIC][49]  = ArabicUtilities.reshapeSentence("ق");
		suratLabelList[ENGLISH][49]  = "050 Kaf";
		suratLabelList[ARABIC][50]  = ArabicUtilities.reshapeSentence("الذريات");
		suratLabelList[ENGLISH][50]  = "051 Al Dhoriyat";
		suratLabelList[ARABIC][51]  = ArabicUtilities.reshapeSentence("الطور");
		suratLabelList[ENGLISH][51]  = "052 Al Tor";
		suratLabelList[ARABIC][52]  = ArabicUtilities.reshapeSentence("النجم");
		suratLabelList[ENGLISH][52]  = "053 Al Nadjm";
		suratLabelList[ARABIC][53]  = ArabicUtilities.reshapeSentence("القمر");
		suratLabelList[ENGLISH][53]  = "054 Al Kamar";
		suratLabelList[ARABIC][54]  = ArabicUtilities.reshapeSentence("الرحمن");
		suratLabelList[ENGLISH][54]  = "055 Al Rahman";
		suratLabelList[ARABIC][55]  = ArabicUtilities.reshapeSentence("الواقعة");
		suratLabelList[ENGLISH][55]  = "056 Al Waki3a";
		suratLabelList[ARABIC][56]  = ArabicUtilities.reshapeSentence("الحديد");
		suratLabelList[ENGLISH][56]  = "057 Al Hadid";
		suratLabelList[ARABIC][57]  = ArabicUtilities.reshapeSentence("المجادلة");
		suratLabelList[ENGLISH][57]  = "058 Al Modjadala";
		suratLabelList[ARABIC][58]  = ArabicUtilities.reshapeSentence("الحشر");
		suratLabelList[ENGLISH][58]  = "059 Al Hachr";
		suratLabelList[ARABIC][59]  = ArabicUtilities.reshapeSentence("الممتحنة");
		suratLabelList[ENGLISH][59]  = "060 Al Momtahana";
		suratLabelList[ARABIC][60]  = ArabicUtilities.reshapeSentence("الصف");
		suratLabelList[ENGLISH][60]  = "061 Al Saf";
		suratLabelList[ARABIC][61]  = ArabicUtilities.reshapeSentence("الجمعة");
		suratLabelList[ENGLISH][61]  = "062 Al Djomo3a";
		suratLabelList[ARABIC][62]  = ArabicUtilities.reshapeSentence("المنافقون");
		suratLabelList[ENGLISH][62]  = "063 Al Monafikoun";
		suratLabelList[ARABIC][63]  = ArabicUtilities.reshapeSentence("التغابن");
		suratLabelList[ENGLISH][63]  = "064 Al Taghabon";
		suratLabelList[ARABIC][64]  = ArabicUtilities.reshapeSentence("الطﻻق");
		suratLabelList[ENGLISH][64]  = "065 Al Talak";
		suratLabelList[ARABIC][65]  = ArabicUtilities.reshapeSentence("التحريم");
		suratLabelList[ENGLISH][65]  = "066 Al Tahreem";
		suratLabelList[ARABIC][66]  = ArabicUtilities.reshapeSentence("الملك");
		suratLabelList[ENGLISH][66]  = "067 Al Molk";
		suratLabelList[ARABIC][67]  = ArabicUtilities.reshapeSentence("القلم");
		suratLabelList[ENGLISH][67]  = "068 Al Kalam";
		suratLabelList[ARABIC][68]  = ArabicUtilities.reshapeSentence("الحاقة");
		suratLabelList[ENGLISH][68]  = "069 Al Haka";
		suratLabelList[ARABIC][69]  = ArabicUtilities.reshapeSentence("المعارج");
		suratLabelList[ENGLISH][69]  = "070 Al Ma3aridj";
		suratLabelList[ARABIC][70]  = ArabicUtilities.reshapeSentence("نوح");
		suratLabelList[ENGLISH][70]  = "071 Nouh";
		suratLabelList[ARABIC][71]  = ArabicUtilities.reshapeSentence("الجن");
		suratLabelList[ENGLISH][71]  = "072 Al Djin";
		suratLabelList[ARABIC][72]  = ArabicUtilities.reshapeSentence("المزمل");
		suratLabelList[ENGLISH][72]  = "073 Al Mozamil";
		suratLabelList[ARABIC][73]  = ArabicUtilities.reshapeSentence("المدثر");
		suratLabelList[ENGLISH][73]  = "074 Al Modathir";
		suratLabelList[ARABIC][74]  = ArabicUtilities.reshapeSentence("القيامة");
		suratLabelList[ENGLISH][74]  = "075 Al Kiyama";
		suratLabelList[ARABIC][75]  = ArabicUtilities.reshapeSentence("اﻹنسان");
		suratLabelList[ENGLISH][75]  = "076 Al Insan";
		suratLabelList[ARABIC][76]  = ArabicUtilities.reshapeSentence("المرسلات");
		suratLabelList[ENGLISH][76]  = "077 Al Morsalat";
		suratLabelList[ARABIC][77]  = ArabicUtilities.reshapeSentence("النبأ");
		suratLabelList[ENGLISH][77]  = "078 Al Naba";
		suratLabelList[ARABIC][78]  = ArabicUtilities.reshapeSentence("النازعات");
		suratLabelList[ENGLISH][78]  = "079 Al Nazi3at";
		suratLabelList[ARABIC][79]  = ArabicUtilities.reshapeSentence("عبس");
		suratLabelList[ENGLISH][79]  = "080 3abassa";
		suratLabelList[ARABIC][80]  = ArabicUtilities.reshapeSentence("التكوير");
		suratLabelList[ENGLISH][80]  = "081 Al Takweer";
		suratLabelList[ARABIC][81]  = ArabicUtilities.reshapeSentence("الإنفطار");
		suratLabelList[ENGLISH][81]  = "082 Al Infitar";
		suratLabelList[ARABIC][82]  = ArabicUtilities.reshapeSentence("المطففون");
		suratLabelList[ENGLISH][82]  = "083 Al Motafifin";
		suratLabelList[ARABIC][83]  = ArabicUtilities.reshapeSentence("الإنشقاق");
		suratLabelList[ENGLISH][83]  = "084 Al Inchikak";
		suratLabelList[ARABIC][84]  = ArabicUtilities.reshapeSentence("البروج");
		suratLabelList[ENGLISH][84]  = "085 Al Boroudj";
		suratLabelList[ARABIC][85]  = ArabicUtilities.reshapeSentence("الطارق");
		suratLabelList[ENGLISH][85]  = "086 Al Tarik";
		suratLabelList[ARABIC][86]  = ArabicUtilities.reshapeSentence("الأعلى");
		suratLabelList[ENGLISH][86]  = "087 Al A3la";
		suratLabelList[ARABIC][87]  = ArabicUtilities.reshapeSentence("الغاشية");
		suratLabelList[ENGLISH][87]  = "088 Al Ghachiya";
		suratLabelList[ARABIC][88]  = ArabicUtilities.reshapeSentence("الفجر");
		suratLabelList[ENGLISH][88]  = "089 Al Fadjr";
		suratLabelList[ARABIC][89]  = ArabicUtilities.reshapeSentence("البلد");
		suratLabelList[ENGLISH][89]  = "090 Al Baled";
		suratLabelList[ARABIC][90]  = ArabicUtilities.reshapeSentence("الشمس");
		suratLabelList[ENGLISH][90]  = "091 Al Shamss";
		suratLabelList[ARABIC][91]  = ArabicUtilities.reshapeSentence("الليل");
		suratLabelList[ENGLISH][91]  = "092 Al Layl";
		suratLabelList[ARABIC][92]  = ArabicUtilities.reshapeSentence("الضحى");
		suratLabelList[ENGLISH][92]  = "093 Al Doha";
		suratLabelList[ARABIC][93]  = ArabicUtilities.reshapeSentence("الشرح");
		suratLabelList[ENGLISH][93]  = "094 Al Sharh";
		suratLabelList[ARABIC][94]  = ArabicUtilities.reshapeSentence("التين");
		suratLabelList[ENGLISH][94]  = "095 Al Tin";
		suratLabelList[ARABIC][95]  = ArabicUtilities.reshapeSentence("العلق");
		suratLabelList[ENGLISH][95]  = "096 Al 3alak";
		suratLabelList[ARABIC][96]  = ArabicUtilities.reshapeSentence("القدر");
		suratLabelList[ENGLISH][96]  = "097 Al Kadr";
		suratLabelList[ARABIC][97]  = ArabicUtilities.reshapeSentence("البينة");
		suratLabelList[ENGLISH][97]  = "098 Al Bayina";
		suratLabelList[ARABIC][98]  = ArabicUtilities.reshapeSentence("الزلزلة");
		suratLabelList[ENGLISH][98]  = "099 Al Zalzala";
		suratLabelList[ARABIC][99]  = ArabicUtilities.reshapeSentence("العاديات");
		suratLabelList[ENGLISH][99]  = "100 Al 3adiyat";
		suratLabelList[ARABIC][100] = ArabicUtilities.reshapeSentence("القارعة");
		suratLabelList[ENGLISH][100] = "101 Al Kari3a";
		suratLabelList[ARABIC][101] = ArabicUtilities.reshapeSentence("التكاثر");
		suratLabelList[ENGLISH][101] = "102 Al Takathor";
		suratLabelList[ARABIC][102] = ArabicUtilities.reshapeSentence("العصر");
		suratLabelList[ENGLISH][102] = "103 Al 3asr";
		suratLabelList[ARABIC][103] = ArabicUtilities.reshapeSentence("الهمزة");
		suratLabelList[ENGLISH][103] = "104 Al Homaza";
		suratLabelList[ARABIC][104] = ArabicUtilities.reshapeSentence("الفيل");
		suratLabelList[ENGLISH][104] = "105 Al Fil";
		suratLabelList[ARABIC][105] = ArabicUtilities.reshapeSentence("قريش");
		suratLabelList[ENGLISH][105] = "106 Koraych";
		suratLabelList[ARABIC][106] = ArabicUtilities.reshapeSentence("الماعون");
		suratLabelList[ENGLISH][106] = "107 Al Ma3oun";
		suratLabelList[ARABIC][107] = ArabicUtilities.reshapeSentence("الكوثر");
		suratLabelList[ENGLISH][107] = "108 Al Kawthar";
		suratLabelList[ARABIC][108] = ArabicUtilities.reshapeSentence("الكافرون");
		suratLabelList[ENGLISH][108] = "109 Al Kafiroun";
		suratLabelList[ARABIC][109] = ArabicUtilities.reshapeSentence("النصر");
		suratLabelList[ENGLISH][109] = "110 Al Nassr";
		suratLabelList[ARABIC][110] = ArabicUtilities.reshapeSentence("المسد");
		suratLabelList[ENGLISH][110] = "111 Al Massad";
		suratLabelList[ARABIC][111] = ArabicUtilities.reshapeSentence("الإخلاص");
		suratLabelList[ENGLISH][111] = "112 Al Ikhlass";
		suratLabelList[ARABIC][112] = ArabicUtilities.reshapeSentence("الفلق");
		suratLabelList[ENGLISH][112] = "113 Al Falak";
		suratLabelList[ARABIC][113] = ArabicUtilities.reshapeSentence("الناس");
		suratLabelList[ENGLISH][113] = "114 Al Nass";

		for(int i=0; i<114; i++) {
			suratLabelList[ARABIC][i] = suratLabelList[ARABIC][i] + getNumber(i);
			suratLabelList[ENGLISH][i] = suratLabelList[ENGLISH][i];
		}

		for (int i=0; i<114; i++)
		{
			if (i< 9) {
				URLS_LIST [CHEIKH_MAHMOUD_EL_HOSSARI] [i] = "http://live1.islamweb.net/quran/hosaree/qaloon/00" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_SAAD_EL_GHAMIDI] [i] = "http://live1.islamweb.net/quran/sghamdi/100" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_ABD_EL_BASSAT] [i] = "http://live1.islamweb.net/quran/baset/s" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_MINSHAWI] [i] = "http://live1.islamweb.net/quran/menshawee/s" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_ADJAMI] [i] = "http://live1.islamweb.net/quran/alajmee/100" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_CHREEM] [i] = "http://live1.islamweb.net/quran/shureem/100" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_SDISS] [i] = "http://live1.islamweb.net/quran/Sudeas/100" + (i+1) + ".mp3";
			}

			else if (i< 99) {
				URLS_LIST [CHEIKH_MAHMOUD_EL_HOSSARI] [i] = "http://live1.islamweb.net/quran/hosaree/qaloon/0" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_SAAD_EL_GHAMIDI] [i] = "http://live1.islamweb.net/quran/sghamdi/10" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_ABD_EL_BASSAT] [i] = "http://live1.islamweb.net/quran/baset/s" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_MINSHAWI] [i] = "http://live1.islamweb.net/quran/menshawee/s" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_ADJAMI] [i] = "http://live1.islamweb.net/quran/alajmee/10" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_CHREEM] [i] = "http://live1.islamweb.net/quran/shureem/10" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_SDISS] [i] = "http://live1.islamweb.net/quran/Sudeas/10" + (i+1) + ".mp3";
			}

			else {
				URLS_LIST [CHEIKH_MAHMOUD_EL_HOSSARI] [i] = "http://live1.islamweb.net/quran/hosaree/qaloon/" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_SAAD_EL_GHAMIDI] [i] = "http://live1.islamweb.net/quran/sghamdi/1" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_ABD_EL_BASSAT] [i] = "http://live1.islamweb.net/quran/baset/s" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_MINSHAWI] [i] = "http://live1.islamweb.net/quran/menshawee/s" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_ADJAMI] [i] = "http://live1.islamweb.net/quran/alajmee/1" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_CHREEM] [i] = "http://live1.islamweb.net/quran/shureem/1" + (i+1) + ".mp3";
				URLS_LIST [CHEIKH_EL_SDISS] [i] = "http://live1.islamweb.net/quran/Sudeas/1" + (i+1) + ".mp3";
			}
		}

		DEBITKB_LIST[CHEIKH_MAHMOUD_EL_HOSSARI] = 16;
		DEBITKB_LIST[CHEIKH_SAAD_EL_GHAMIDI]    = 64;
		DEBITKB_LIST[CHEIKH_ABD_EL_BASSAT]      = 64;
		DEBITKB_LIST[CHEIKH_EL_MINSHAWI]        = 16;
		DEBITKB_LIST[CHEIKH_EL_ADJAMI]          = 64;
		DEBITKB_LIST[CHEIKH_EL_CHREEM]          = 64;
		DEBITKB_LIST[CHEIKH_EL_SDISS]           = 32;
	}

	public static final MyListAdapter INSTANCE = new MyListAdapter();
	private MyListAdapter() {};

	/**
	 * the path of the fonts file must be under assets folder
	 */
	private static final String FONTS_LOCATION_PATH = "fonts/DejaVuSans.ttf";

	Typeface face = null;
	public void setContext(Context context)
	{
		face = Typeface.createFromAsset(context.getAssets(), FONTS_LOCATION_PATH);
	}

	public void setLanguage(int language)
	{
		this.language = language;
		notifyDataSetChanged();
		refreshLabel();
	}

	public long getGroupId(int groupPosition) { return groupPosition; }
	public long getChildId(int groupPosition, int childPosition) { return childPosition; }
	public Object getGroup(int groupPosition) {
		if (groupPosition == 0)
			return chikhList[language];
		return suratLabelList[language];
	}
	public Object getChild(int groupPosition, int childPosition) {
		if (groupPosition == 0)
			return chikhList[language][childPosition];
		return suratLabelList[language][childPosition];
	}
	public int getGroupCount() { return 2; }
	public int getChildrenCount(int groupPosition) {
		if (groupPosition == 0)
			return chikhList[language].length;
		return suratLabelList[language].length;
	}
	public boolean isChildSelectable(int groupPosition, int childPosition) { return true; }
	public boolean hasStableIds() { return true; }

	public TextView getGenericView(int groupPosition) {
		AbsListView.LayoutParams lp = new AbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, 64);
		TextView textView = new TextView(Initial.INSTANCE);
		textView.setLayoutParams(lp);
		textView.setTextSize(20 + groupPosition * 10);
		if (language == ARABIC) {
			textView.setTypeface(face);
			textView.setGravity(Gravity.RIGHT);	
		} else {
			textView.setTypeface(Typeface.DEFAULT);
			textView.setGravity(Gravity.LEFT);
		}
		//textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
		textView.setPadding(36, 0, 0, 0);
		return textView;
	}

	public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
		TextView textView = getGenericView(groupPosition);
		textView.setText(getChild(groupPosition, childPosition).toString());
		if (language == ARABIC) {
			textView.setTypeface(face);
			textView.setGravity(Gravity.RIGHT);
		} else {
			textView.setTypeface(Typeface.DEFAULT);
			textView.setGravity(Gravity.LEFT);
		}
		return textView;
	}

	private static String getNumber(int i)
	{
		++i;

		if (i<10 ) {
			switch(i) {
			case 1: return "\t100";
			case 2: return "\t200";
			case 3: return "\t300";
			case 4: return "\t400";
			case 5: return "\t500";
			case 6: return "\t600";
			case 7: return "\t700";
			case 8: return "\t800";
			case 9: return "\t900";
			};
		}

		if (i<100) return "\t 0" + i;
		return            "\t  " + i;
	}

	public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
		TextView textView = getGenericView(groupPosition);
		if (groupPosition == 0) // cheikh
			textView.setText(chikhList[language][_currentCheikh]);
		else // surat
			textView.setText(suratLabelList[language][_currentSurat]);
		if (language == ARABIC) {
			textView.setTypeface(face);
			textView.setGravity(Gravity.RIGHT);
		} else {
			textView.setTypeface(Typeface.DEFAULT);
			textView.setGravity(Gravity.LEFT);
		}
		return textView;
	}

	public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
		if (groupPosition == 0) { // cheikh selected
			_currentCheikh = childPosition;
			Initial.INSTANCE.list.collapseGroup(0);
		}
		else if (groupPosition == 1) { // surat selected
			_currentSurat = childPosition;
			final String url = URLS_LIST[_currentCheikh][childPosition];
			Initial.INSTANCE.list.collapseGroup(1);
			refreshLabel();
			Initial.INSTANCE.startStreamingAudio(url, DEBITKB_LIST[_currentCheikh]);
		}
		return true;
	}

	public void refreshLabel()
	{
		if (language == ARABIC) {
			Initial.INSTANCE.label.setText(
					ArabicUtilities.reshapeSentence("الشيخ") +
					":  " +
					chikhList[ARABIC][_currentCheikh] +
					"\n" +
					ArabicUtilities.reshapeSentence("السورة") +
					":  " +
					suratLabelList[ARABIC][_currentSurat]
			);
			Initial.INSTANCE.label.setTypeface(face);
			Initial.INSTANCE.label.setGravity(Gravity.RIGHT);
		}
		else {
			Initial.INSTANCE.label.setText(
					"Al Cheikh:" +
					chikhList[ENGLISH][_currentCheikh] +
					"\n" +
					"Al Surat:" +
					suratLabelList[ENGLISH][_currentSurat]
			);
			Initial.INSTANCE.label.setTypeface(Typeface.DEFAULT);
			Initial.INSTANCE.label.setGravity(Gravity.LEFT);
		} 
	}

	@Override
	public void onGroupExpand(int groupPosition) {
		if (groupPosition == 0) // cheikh
			Initial.INSTANCE.list.setSelection(_currentCheikh);
		else if (groupPosition == 1)
			Initial.INSTANCE.list.setSelection(_currentSurat);
	}

	public void nextSurat()
	{
		++_currentSurat;
		if (_currentSurat >= 114)
			_currentSurat = 0;

		playCurrentSurat();
	}

	public void prevoiusSurat()
	{
		--_currentSurat;
		if (_currentSurat < 0)
			_currentSurat = 113;

		playCurrentSurat();
	}

	public void playCurrentSurat()
	{
		notifyDataSetChanged();
		onChildClick(null, null, 1, _currentSurat, -1);
	}
}
